#########################################################
#Figure 1: Euroscepticism Distribution Among Remain Voters
#########################################################

d <- read.dta13("./temp/fig1data.dta")
d <- d[d$leaveW9 == 0,]
vars <- c("EUIntegrationSelfW8" )
d <- d[vars]
d <- na.omit(d)
ggplot(d, aes(as.factor(EUIntegrationSelfW8))) + 
  geom_bar(aes(y = (..count..)/sum(..count..)), color="white", fill="gray40", alpha=.9, width = .7) + 
  scale_y_continuous(labels = scales::percent_format(accuracy = 1L), limits=c(0,.2)) + coord_flip() + xlab(" ") + ylab("Percent") + theme_nice() +
  theme(axis.title = element_text(size=20),
        axis.text = element_text(size=17),
        panel.grid.minor = element_blank(),
        panel.grid.major.y = element_blank(),
        panel.grid.major.x=element_line(linetype="solid"))  
ggsave("./figures/fig1.pdf")
rm(d, vars)
